# -*- coding: utf-8 -*-
# Create your models here.
from django.db import models

class Question(models.Model):
    question_text = models.CharField("问题",max_length=50)
    pub_date = models.DateField("发布时间")

class Choice(models.Model):
    question = models.ForeignKey(Question)
    choice_text = models.CharField(verbose_name="选项",max_length=200)
    vote = models.IntegerField(verbose_name="投票数",default=0)
    def __str__(self):
        return self.choice_text

class MsgPost(models.Model):
    user = models.CharField(max_length=12)
    email = models.EmailField(blank=True)
    title = models.CharField(max_length=30)
    content = models.TextField()
    datetime = models.DateTimeField(auto_now_add=True)
    class Meta:
        ordering = ['-datetime']